Namespace MRUItems
    <DebuggerDisplay("OfficeMRUItem: Name = {Name}, ItemText = {ItemText}")>
    Friend Class OfficeMRUItem
        Inherits ProjectMRUItem

        Public Sub New()
            SupportsExtendedItems = False
        End Sub

        Public Overrides Function Populate(szName As String, szItemText As String) As Boolean
            Try
                If (Not szName.StartsWith("Item", StringComparison.OrdinalIgnoreCase)) Then Return False

                Name = szName
                ItemText = szItemText

                Dim aszParts As String() = szItemText.Split("*".ToCharArray(), StringSplitOptions.RemoveEmptyEntries)
                Dim bPinned As Boolean? = Nothing
                If aszParts.Length > 1 Then
                    Path = aszParts(1)

                    Dim iIndex As Integer = aszParts(0).IndexOf("]"c)
                    If (iIndex > 0) Then
                        bPinned = MRUConvert.ToNullableBoolean(aszParts(0)(iIndex - 1))
                    End If
                Else
                    Path = szItemText
                End If

                Pinned = bPinned.HasValue AndAlso bPinned.Value
                Return True
            Catch oExp As Exception
                ' If we have an exception in the constructor, 
                ' we need to dispose of resources allocated before the exception occurred. 
                LogException(oExp)
                Throw
            End Try
        End Function
    End Class
End NameSpace